package game.view.assignmentMenu
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	import game.UIComponent.FoodTypeSquare;
	import game.UIComponent.ScrollBar;
	import game.UIComponent.TabButton;
	import game.common.CustomBitmap;
	import game.managers.LanguageManager;
	import game.utils.Utils;
	
	public class TaskType extends Sprite
	{
		private var _taskOne:TabButton;
		private var _taskTwo:TabButton;
		private var _receive:TabButton;
		private var _secondBg:CustomBitmap;
		private var _now:TabButton;
		private var _titletext:TextField;
		private var _firsttask:TaskOneType;
		private var _secondtask:TaskTwoType;
		private var _title:CustomBitmap;
		
		public function TaskType()
		{
			init();
		}
		private function init():void
		{
			
			_title=new CustomBitmap();
			_title.source="missionTitle";
			_title.x=120;
			_title.y=-180;
			addChild(_title);
			
			
			_titletext=Utils.getCommonTextField(LanguageManager.getWord("titletxt"),18,this.x+20,this.y-80);
			addChild(_titletext);
			
			_receive=new TabButton(LanguageManager.getWord(" "),clickHandler,"getAllBtn");
			_receive.x=_titletext.x+350;
			_receive.y=_titletext.y+50;
			addChild(_receive);
			
			_taskOne=new TabButton(LanguageManager.getWord("taskone"),taskclickHandler);
			_taskOne.width=130;
			_taskOne.height=50;
			_taskOne.y=20;
			_taskOne.choose=true;
			_now=_taskOne;
			addChild(_taskOne);
			
			_taskTwo=new TabButton(LanguageManager.getWord("taketwo"),taskclickHandler);
			_taskTwo.width=130;
			_taskTwo.height=50;
			_taskTwo.y=_taskOne.y+_taskOne.height+15;
			addChild(_taskTwo);
			
			_secondBg=new CustomBitmap();
			_secondBg.source="secondBg";
			_secondBg.x=_taskOne.x+_taskOne.width-50;	
			_secondBg.y=_taskOne.y;
			_secondBg.width=380;
			addChild(_secondBg);
			
			_firsttask=new TaskOneType();
			_firsttask.x=_secondBg.x+30;
			_firsttask.y=_secondBg.y+10 ;
			_taskOne.binding=_firsttask;
			addChild(_firsttask);
			
			_secondtask=new TaskTwoType();
			_secondtask.x=_secondBg.x+30;
			_secondtask.y=_secondBg.y+10 ;
			_secondtask.visible=false;
			_taskTwo.binding=_secondtask;
			addChild(_secondtask);
			
		}
		
		private function taskclickHandler(e:MouseEvent):void
		{
			var btn:TabButton = e.target as TabButton;
			if(btn == _now) return;
			if(_now)_now.choose = false;
			btn.choose = true;
			_now = btn;
			
			switch(btn){
				case _taskOne:
					break;
				case _taskTwo:
					break;
				
			}
	     }
		
		private function clickHandler(e:MouseEvent):void
		{
	
		}
}
}